﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sherwood.Localization
{
    /// <summary>
    /// Interface for translation providers that handle simple string translations.
    /// </summary>
    public interface ITranslationProvider
    {
        /// <summary>
        /// Sets the active translation culture (the language strings will be translated to).
        /// </summary>
        /// <param name="cultureName">The .Net culture name (e.g. 'en-US')</param>
        void SetCulture(string cultureName);

        /// <summary>
        /// Returns a translation corrosponding to the provided key in the active translation culture.
        /// Translation culture can be changed using the SetCulture() method.
        /// </summary>
        /// <param name="key">Translation key</param>
        /// <returns>Translated string or key if no translation is found</returns>
        string GetString(string key);

        /// <summary>
        /// Returns a translation corrosponding to the provided key in the active translation culture.
        /// Translation culture can be changed using the SetCulture() method.
        /// </summary>
        /// <param name="key">Translation key</param>
        /// <param name="defaultValue">The value to be returned if no translation is found.</param>
        /// <returns>Translated string or defaultValue if no translation is found</returns>
        string GetString(string key, string defaultValue);

        /// <summary>
        /// Returns a translation corrosponding to the provided key in the active translation culture.
        /// Translation culture can be changed using the SetCulture() method.
        /// </summary>
        /// <param name="key">Translation key</param>
        /// <param name="defaultValue">The value to be returned if no translation is found.</param>
        /// <param name="callback">The function to call once translation has been obtained</param>
        void GetStringAsync(string key, string defaultValue, TranslationCallback callback, object state);

        /// <summary>
        /// Returns a translation corrosponding to the provided key in the active translation culture.
        /// Translation culture can be changed using the SetCulture() method.
        /// </summary>
        /// <param name="key">Translation key</param>
        /// <returns>Translated string or key if no translation is found</returns>
        string this[string key] {get;}

    }

    public delegate void TranslationCallback(string key, string translation, object state);
 
}
